var e = require;
var t = module;
var n = exports;
"use strict";
var o, i = this && this.__extends || (o = function (e, t) {
    return (o = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) {
        e.__proto__ = t
    } || function (e, t) {
        for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
    })(e, t)
}, function (e, t) {
    function n() {
        this.constructor = e
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
}), r = this && this.__decorate || function (e, t, n, o) {
    var i, r = arguments.length, y = r < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate)
        y = Reflect.decorate(e, t, n, o);
    else
        for (var a = e.length - 1; 0 <= a; a--) (i = e[a]) && (y = (r < 3 ? i(y) : 3 < r ? i(t, n, y) : i(t, n)) || y);
    return 3 < r && y && Object.defineProperty(t, n, y), y
};
Object.defineProperty(n, "__esModule", { value: !0 });
var y, a = e("BaseUI"), s = e("EventConst"), c = e("PopupConst"), x = e("UserConst"), l = e("EventManager"), h = e("PlatformManager"), d = e("PopupManager"), u = e("UserManager"), t = cc._decorator, e = t.ccclass, e = (t.property, y = a.default, i(f, y), 
f.prototype.onLoad = function () {
    y.prototype.onLoad.call(this), 
    this.level = this.dict.level, 
    this.addBtnOn("keyBtn", this.clickKey, this), 
    this.addBtnOn("tipBtn", this.clickTip, this), 
    this.addBtnOn("skipBtn", this.clickSkip, this), 
    this.initView();
}, 
f.prototype.onEnable = function () {
    l.Event.on(s.default.KEY_UPDATE, this.initView, this), 
    l.Event.on(s.default.UPDATE_IS_UNLOCK_TIP, this.updateIsUnlockTip, this)
}, 
f.prototype.onDisable = function () {
    l.Event.off(s.default.KEY_UPDATE, this.initView, this), 
    l.Event.off(s.default.UPDATE_IS_UNLOCK_TIP, this.updateIsUnlockTip, this)
}, 
f.prototype.updateIsUnlockTip = function () {
    this.isUnlockTip = !1, 
    this.initTipView()
}, 
f.prototype.initView = function () {
    this.initTipView(), 
    this.initSkipView()
}, 
f.prototype.initTipView = function () {
    this.isUnlockTip ? (
        console.log("dsdfdsfds"), 
        this.dict.tipVideo.active = !1, 
        this.dict.tipEnough.active = !1
    ) : 1 <= u.User.get(x.UserData.KEY) ? (
        this.dict.tipVideo.active = !1, 
        this.dict.tipEnough.active = !0
    ) : (
        this.dict.tipVideo.active = !0, 
        this.dict.tipEnough.active = !1
    )
}, 
f.prototype.initSkipView = function () {
    var e;
    u.User.getTempData(x.TempData.IS_WIN) || (
        e = u.User.get(x.UserData.KEY), 
        this.dict.skipVideo.active = !(2 <= e)
    )
}, 
f.prototype.clickKey = function () {
    u.User.getTempData(x.TempData.IS_WIN) || (
        cc.game.emit("gamelog", "btn016"), 
        window.__prv.showVideo(function () {
            console.error("点击钥匙");
            
                cc.game.emit("gamelog", "rewarde_btn002"), 
                e = u.User.get(x.UserData.KEY), 
                u.User.set(x.UserData.KEY, e + 1), 
                l.Event.emit(s.default.KEY_EFFECT)
            
        })
    )
}, 
f.prototype.clickTip = function () {
    var e, t = this;
    if (!u.User.getTempData(x.TempData.IS_WIN)) {
        if (this.isUnlockTip) return d.Popup.show(c.PopupConst.TIP);
        this.dict.tipVideo.active ? (
            cc.game.emit("gamelog", "btn017"), 
            window.__prv.showVideo(function () {
                    console.error("点击提示");
                    cc.game.emit("gamelog", "rewarde_btn003"), 
                    t.isUnlockTip = !0, 
                    t.initTipView(), 
                    cc.game.emit("gamelog", "page006"), 
                    d.Popup.show(c.PopupConst.TIP)
            })
        ) : (
            cc.game.emit("gamelog", "btn018"), 
            e = u.User.get(x.UserData.KEY) - 1, 
            u.User.set(x.UserData.KEY, e = e <= 0 ? 0 : e), 
            l.Event.emit(s.default.KEY_UPDATE), 
            this.isUnlockTip = !0, 
            this.initTipView(), 
            cc.game.emit("gamelog", "page005"), 
            d.Popup.show(c.PopupConst.TIP)
        )
    }
}, 
f.prototype.clickSkip = function () {
    cc.game.emit("gamelog", "btn019"), 
    this.dict.skipVideo.active ? window.__prv.showVideo(function () {
        console.error("点击跳过");
        var t;
            t = u.User.getTempData(x.TempData.CURRENT_LEVEL), 
            e = u.User.getTempData(x.TempData.CURRENT_MODE), 
            t <= 100 && cc.game.emit("gamelog", "Level_Skip_" + e + "_" + t), 
            cc.game.emit("gamelog", "rewarde_btn004"), 
            cc.game.emit("game_success2")
    }) : d.Popup.show(c.PopupConst.SKIP)
}, 
r([e], f));
function f() {
    var e = null !== y && y.apply(this, arguments) || this;
    return e.level = null, e.isUnlockTip = !1, e
}
n.default = e
